import { observable, action } from "mobx";
import net from "../services/net";

export default class Store {
	@observable blogs = [];
	@observable type = "/blogs";  // blog house
	@action 
	getBlogList = async () => {
		const result = await net.get("/acticles");
		if(result && result.code === 1) {
			this.blogs = result.data;
			return result.data;
		}
		return {};
	}
	@action 
	getBlog = async (id) => {
		const result = await net.get(`/acticles/${id}`);
		if(result && result.code === 1) {
			return result.data;
		}
		return {};
	}
	@action 
	changeType = (type) => {
		this.type = type;
	}
}